﻿<?

require("conn.php");
mysql_query('set names UTF8');
$sql = "select catIndex,catId,name,concat(catpath,'-',catIndex) as abspath from category order by abspath";

$query = mysql_query ( $sql );
mysql_query('set names UTF8');
$cat = array();
while ( $row = mysql_fetch_array ( $query ) ) {

		array_push($cat,
			array(
				'index' => $row ['catIndex'],
				'id' => $row ['catId'],
				'name' => $row ['name'],
				'abspath' => $row ['abspath']
			));
	};
	

echo json_encode($cat);
?>